﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HitachiLib.HitachiServiceRef;

namespace HitachiLib.Data
{
    public class CoreData
    {
        private List<Project> all_projects = new List<Project>();
        private List<Resource> all_resources = new List<Resource>();
        private List<Schedule> all_schedules = new List<Schedule>();

        private Dictionary<int, Project> project_map = new Dictionary<int, Project>();
        private Dictionary<int, Resource> resource_map = new Dictionary<int, Resource>();
        private Dictionary<int, Schedule> schedule_map = new Dictionary<int, Schedule>();

        public void Clear()
        {
            all_projects.Clear();
            all_resources.Clear();
            all_schedules.Clear();
            project_map.Clear();
            resource_map.Clear();
            schedule_map.Clear();
        }

        public static void Link(WholeLineData data, Project current_line)
        {
            List<Project> project_list = Project.Link(data.Projects);

            foreach (ScheduleData sd in data.Schedules)
            {
                Schedule s = new Schedule();
                s.Data = sd;
                Project p = Project.GetUnique(s.Data.ProjectId);
                if (p != null)
                {
                    p.PlanSchedule[s.Data.ActionType] = s;
                    s.Proj = p;
                }
            }
        }
        /*
        public void Create(List<Project> line_projects, WholeLineData data)
        {
            foreach (Project p in line_projects)
            {
                project_map.Add(p.Id, p);
            }
            foreach (ProjectData pd in data.Projects)
            {
                Project p = new Project(pd);
                project_map.Add(p.Id, p);
            }
        }
         * */
    }
}
